FROM --platform=amd64 alpine-jdk:8 AS java_target
LABEL MAINTAINER="Bert" email="Bert-long@outlook.com"
WORKDIR /app
ARG JAR_PATH
ARG JVM_ARG
# ENTRYPOINT 只认 ENV 环境变量
ENV TZ=Asia/Shanghai LC_ALL=en_US.utf8 APP_PATH=${JAR_PATH} JAVA_OPTS=${JVM_ARG}
COPY ${APP_PATH} /app
# log4j2启动慢添加参数: -Dlogstash-gelf.skipHostnameResolution=true
ENTRYPOINT ["sh","-c","java \
    -Djava.security.egd=file:/dev/./urandom \
    -XX:+HeapDumpOnOutOfMemoryError \
    -Dspring.profiles.active=prod \
    ${JAVA_OPTS} -jar /app/$(basename $APP_PATH)" \
]